﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AirlineProject.Models;
namespace AirlineProject.Areas.admin.Controllers
{
    public class templateadminController : Controller
    {
        public ActionResult Index()
        {
            return View("welcome");
        }
        public ActionResult User()
        {
            return View();
        }
        public ActionResult Flight()
        {
            return View();
        }
        public ActionResult Orgin()
        {
            return View();
        }
        public ActionResult Destination()
        {
            return View();
        }
        public ActionResult Ticket()
        {
            return View();
        }
        public ActionResult Bill()
        {
            return View();
        }
        public ActionResult Home()
        {
            return View();
        }
        public ActionResult Formpayment()
        {
            return View();
        }
        public ActionResult TypeTicket()
        {
            return View();
        }
        public ActionResult handadduser(string user_name, string password, string first_name, string last_name, string address, string phone_number, string email, int gender, string DOB)
        {
            AccountModels ac = new AccountModels();
            string v = string.Empty;
            if (ac.AddUser(user_name, password, first_name, last_name, address, phone_number, email, gender, (Convert.ToDateTime(DOB)), 0))
            {
                v = "user";
            }
            else
            {
                v = "adduser";
                ViewData["massage"] = "Account registration failed";
            }
            return View(v);
        }
        public ActionResult handaddflight(int orgin_id, int destination_id, string departure_date, double flight_price, int seat_num)
        {
            DataModels da = new DataModels();
            string v = string.Empty;
            if (da.Addflight(orgin_id, destination_id, (Convert.ToDateTime(departure_date)), flight_price, seat_num))
            {
                v = "flight";
            }
            else
            {
                v = "addflight";
                ViewData["message"] = "add flight failed";
            }
            return View(v);
        }
        public ActionResult handaddorigin(int origin_id, string place_name, int place_parentid)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.addorigin(origin_id, place_name, place_parentid))
            {
                v = "origin";
            }
            else
            {
                v = "Them";
                ViewData["message"] = "add origin failed";
            }
            return View(v);
        }
        public ActionResult handadddestination(int destination_id, string place_name, int place_parentid)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.adddestination(destination_id, place_name, place_parentid))
            {
                v = "destination";
            }
            else
            {
                v = "Them";
                ViewData["message"] = "add destination failed";
            }
            return View(v);
        }

        public ActionResult deleteuser(int id)
        {
            AccountModels tk = new AccountModels();
            string v = string.Empty;
            if (tk.DeleteUser(id))
            {
                v = "user";
            }
            else
            {
                v = "user";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deleteflight(int id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deleteflight(id))
            {
                v = "flight";
            }
            else
            {
                v = "flight";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deletebill(string id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deletebill(id))
            {
                v = "bill";
            }
            else
            {
                v = "bill";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deleteticket(string id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deleteticket(id))
            {
                v = "ticket";
            }
            else
            {
                v = "ticket";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deleteorigin(int id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deleteorigin(id))
            {
                v = "origin";
            }
            else
            {
                v = "origin";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deletedestination(int id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deletedestination(id))
            {
                v = "destination";
            }
            else
            {
                v = "destination";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deletetypeticket(int id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deletedestination(id))
            {
                v = "TypeTicket";
            }
            else
            {
                v = "TypeTicket";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
        public ActionResult deleteformpayment(int id)
        {
            DataModels sp = new DataModels();
            string v = string.Empty;
            if (sp.deleteformpayment(id))
            {
                v = "Formpayment";
            }
            else
            {
                v = "Formpayment";
                ViewData["message"] = "delete failed";
            }
            return View(v);
        }
    }
}
